Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONTINT-4506] add resource labels and annotations as tags to orchestrator #32877

Conversation

ewoodthomas
Copy link
Contributor

@ewoodthomas ewoodthomas commented Jan 10, 2025

What does this PR do?

Adds Kubernetes resource labels and annotations as tags in the orchestrator check when configured with kubernetesResourcesLabelsAsTags and kubernetesResourcesAnnotationsAsTags. Improves tagging consistency.

Motivation

Support for kubernetesResourcesLabelsAsTags and kubernetesResourcesAnnotationsAsTags has already been released in official documentation. However, the orchestrator check does not emit these tags.

Describe how you validated your changes

Added unit tests that cover tag addition for every k8s resource type the orchestrator check supports.

Manually tested:

  1. Deploy the agent with the following added to the config:
datadog:
  ...
  kubernetesResourcesLabelsAsTags:
    clusterroles.rbac.authorization.k8s.io:
      foo1: bar1
  kubernetesResourcesAnnotationsAsTags:
    clusterroles.rbac.authorization.k8s.io:
      foo2: bar2
  1. Deploy a clusterrole with the following config:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: example-cluster-role
  labels:
    role-type: management
    team: devops
    environment: production
    foo1: example-value
  annotations:
    foo2: example-anno
rules:
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["list", "get"]
  1. Check the orchestrator explorer and verify the tags bar1:example-value and bar2:example-anno are present for example-cluster-role

I did not manually test every resource, but unit tests alone validate the changes.

Possible Drawbacks / Trade-offs

Additional Notes

The changes for this could likely be limited to the transformers. We would just need to call some initialization when starting the orchestrator check to GetMetadataTags to avoid getting it every time a resource is extracted.

The main driver for the changes to the processors and collectors is to easily allow support for CRs and CRDs in the future. To know the resource type, we need the name and version passed into the collector. Hence, we need to change the collectors to pass this information down to the Processor.

Feel free to suggest other ways of going about this, I've gone back and forth between a few different ideas.

@ewoodthomas ewoodthomas added the qa/done QA done before merge and regressions are covered by tests label Jan 10, 2025
@github-actions github-actions bot added the long review PR is complex, plan time to review it label Jan 10, 2025
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 10, 2025

Uncompressed package size comparison

Comparison with ancestor 8e438569c5c192f5f59092af9274c5a57d68191d

Diff per package
package diff status size ancestor threshold
datadog-agent-x86_64-rpm 0.04MB ⚠️ 938.85MB 938.80MB 0.50MB
datadog-agent-x86_64-suse 0.04MB ⚠️ 938.85MB 938.80MB 0.50MB
datadog-agent-amd64-deb 0.04MB ⚠️ 929.18MB 929.14MB 0.50MB
datadog-agent-aarch64-rpm 0.04MB ⚠️ 925.49MB 925.45MB 0.50MB
datadog-agent-arm64-deb 0.04MB ⚠️ 915.85MB 915.81MB 0.50MB
datadog-dogstatsd-amd64-deb 0.00MB 58.93MB 58.93MB 0.50MB
datadog-dogstatsd-x86_64-rpm 0.00MB 59.01MB 59.01MB 0.50MB
datadog-dogstatsd-x86_64-suse 0.00MB 59.01MB 59.01MB 0.50MB
datadog-dogstatsd-arm64-deb 0.00MB 56.44MB 56.44MB 0.50MB
datadog-heroku-agent-amd64-deb 0.00MB 477.44MB 477.44MB 0.50MB
datadog-iot-agent-amd64-deb 0.00MB 94.00MB 94.00MB 0.50MB
datadog-iot-agent-x86_64-rpm 0.00MB 94.07MB 94.07MB 0.50MB
datadog-iot-agent-x86_64-suse 0.00MB 94.06MB 94.06MB 0.50MB
datadog-iot-agent-arm64-deb 0.00MB 90.04MB 90.04MB 0.50MB
datadog-iot-agent-aarch64-rpm 0.00MB 90.11MB 90.11MB 0.50MB

Decision

⚠️ Warning

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 10, 2025

[Fast Unit Tests Report]

On pipeline 53622325 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_flavor_dogstatsd_deb-x64
  • tests_flavor_heroku_deb-x64
  • tests_flavor_iot_deb-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-devx-help

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Jan 10, 2025

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv aws.create-vm --pipeline-id=53622325 --os-family=ubuntu

Note: This applies to commit 87f52f5

@ewoodthomas ewoodthomas marked this pull request as ready for review January 10, 2025 19:52
@ewoodthomas ewoodthomas requested review from a team as code owners January 10, 2025 19:52
@jhgilbert jhgilbert self-assigned this Jan 10, 2025
@ewoodthomas ewoodthomas changed the title Ewoodthomas/contint 4506 add resource labels and annotations as tags to orchestrator [CONTINT-4506] add resource labels and annotations as tags to orchestrator Jan 10, 2025
Copy link

cit-pr-commenter bot commented Jan 10, 2025

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 0b95ff33-bb9d-43d3-b38b-4dbf1328ae9f

Baseline: 4269c6c
Comparison: 87f52f5
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
uds_dogstatsd_to_api_cpu % cpu utilization +0.99 [+0.28, +1.70] 1 Logs
file_to_blackhole_1000ms_latency egress throughput +0.49 [-0.31, +1.28] 1 Logs
quality_gate_logs % cpu utilization +0.19 [-3.00, +3.38] 1 Logs
file_to_blackhole_1000ms_latency_linear_load egress throughput +0.14 [-0.32, +0.61] 1 Logs
file_to_blackhole_500ms_latency egress throughput +0.07 [-0.71, +0.84] 1 Logs
file_to_blackhole_0ms_latency_http1 egress throughput +0.02 [-0.88, +0.92] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput +0.01 [-0.01, +0.02] 1 Logs
uds_dogstatsd_to_api ingress throughput +0.00 [-0.10, +0.11] 1 Logs
file_to_blackhole_300ms_latency egress throughput +0.00 [-0.64, +0.64] 1 Logs
file_to_blackhole_0ms_latency egress throughput -0.01 [-0.85, +0.84] 1 Logs
file_to_blackhole_100ms_latency egress throughput -0.02 [-0.74, +0.70] 1 Logs
file_to_blackhole_0ms_latency_http2 egress throughput -0.02 [-0.83, +0.78] 1 Logs
quality_gate_idle memory utilization -0.07 [-0.11, -0.04] 1 Logs bounds checks dashboard
tcp_syslog_to_blackhole ingress throughput -0.08 [-0.14, -0.02] 1 Logs
quality_gate_idle_all_features memory utilization -0.58 [-0.66, -0.49] 1 Logs bounds checks dashboard
file_tree memory utilization -1.37 [-1.53, -1.20] 1 Logs

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
file_to_blackhole_0ms_latency lost_bytes 10/10
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_0ms_latency_http1 lost_bytes 10/10
file_to_blackhole_0ms_latency_http1 memory_usage 10/10
file_to_blackhole_0ms_latency_http2 lost_bytes 10/10
file_to_blackhole_0ms_latency_http2 memory_usage 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency_linear_load memory_usage 10/10
file_to_blackhole_100ms_latency lost_bytes 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_300ms_latency lost_bytes 10/10
file_to_blackhole_300ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency lost_bytes 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
quality_gate_idle intake_connections 10/10 bounds checks dashboard
quality_gate_idle memory_usage 10/10 bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 bounds checks dashboard
quality_gate_logs intake_connections 10/10
quality_gate_logs lost_bytes 10/10
quality_gate_logs memory_usage 10/10

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.

Copy link
Contributor

@kangyili kangyili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, please remove the testing log

@ewoodthomas
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 22, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-22 02:39:53 UTC ℹ️ MergeQueue: pull request added to the queue

The median merge time in main is 34m.


2025-01-22 03:12:07 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit 634cc25 into main Jan 22, 2025
235 checks passed
@dd-mergequeue dd-mergequeue bot deleted the ewoodthomas/CONTINT-4506_add_resource_labels_and_annotations_as_tags_to_orchestrator branch January 22, 2025 03:12
@github-actions github-actions bot added this to the 7.63.0 milestone Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long review PR is complex, plan time to review it qa/done QA done before merge and regressions are covered by tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants